package me.miencraft.plugin.superlobby;

import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import me.miencraft.plugin.superlobby.util.VisiblePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
 * @author langle__
 * @version 1.0
 */
public class Placeholder extends PlaceholderExpansion {

    @Override
    public @NotNull String getIdentifier() {
        return "SuperLobby";
    }

    @Override
    public @NotNull String getAuthor() {
        return "langle__";
    }

    @Override
    public @NotNull String getVersion() {
        return "1.0.0";
    }

    @Override
    public boolean persist() {
        return true;
    }

    @Override
    public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
        switch (params) {
            case "visible":
                return String.valueOf(VisiblePlayer.isVisible(player));
            case "visible_form":
                return VisiblePlayer.isVisible(player) ? "§a启用" : "§c禁用";
        }
        return null;
    }

}
